import config from '@/config'
import { login, logout, getInfo } from '@/api/login'
import { getToken, setToken, removeToken, getIsLogin } from '@/utils/auth'

const baseUrl = config.baseUrl

const user = {
  namespaced: true,
  state: {
    token: getToken() || '',
    userInfo: {
		avatarUrl: 'https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83erndzf2nJh6VRwF6C3sKt9OwQWEokjQuibGY4DRxUO6ibsiaNzj8QfIIHJKZCt90Tu2TV6ibzyq5a32tA/132',
		nickname: '陶医生',
		sex: '男',
		single: '2002-12-20',
		describe: '全国一级急诊专家'
	},
	isLogin: getIsLogin() || false
  },
  mutations: {
    SET_TOKEN: (state, payload) => {
      state.token = payload
    },
    SET_USERINFO: (state, payload) => {
      state.userInfo = payload
    },
	SET_ISLOGIN: (state, payload) => {
	  state.isLogin = payload
	},
	CLEAR_TOKEN: (state) => {
		state.token = false
		state.userInfo ={}
		state.isLogin = false
	}
  },

  actions: {
    // 登录
    

    // 获取用户信息
    
    

    // 退出系统
   
  },
  getters: {
	  token: state => state.user.token,
	  avatar: state => state.user.avatar,
	  name: state => state.user.name,
	  roles: state => state.user.roles,
	  permissions: state => state.user.permissions
  }
}

export default user
